<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
//        const obj = {
//            user: "jj",
//            age: 12
//        };

//        let {user, age} = obj;            //简写方式      当键名跟变量名一致可简写
//        document.writeln(`user = ${user} age = ${age}`);    //user = jj age = 12

//        let {age: a, user: u} = obj;        //age(模式) a(变量)
//        document.writeln(`user = ${u} age = ${a}`);    //user = jj age = 12
//-------------------------------------------------------------------------------------
//        const obj = {
//            num: 12
//        };
//
//        let num;
//        ({num} = obj);      //解构对象时大括号可能出现歧义（大括号会被理解成代码块），只需要用一对圆括号包裹即可
//        alert(num);     //12

    </script>
</head>
<body>

</body>
</html>